package top.likeqc.leetcode.editor.cn;

/**
 * @see <a href="https://leetcode.cn/problems/minimum-operations-to-make-the-array-increasing">leetcode题库</a>
 */
public class MinimumOperationsToMakeTheArrayIncreasing {
    public static void main(String[] args) {
        Solution solution = new MinimumOperationsToMakeTheArrayIncreasing().new Solution();
    }
    
    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int minOperations(int[] nums) {
            int res = 0;
            for (int i = 1; i < nums.length; i++) {
                if (nums[i] <= nums[i - 1]) {
                    int t = nums[i];
                    nums[i] = nums[i - 1] + 1;
                    res += nums[i] - t;
                }
            }
            return res;
        }
    }
    //leetcode submit region end(Prohibit modification and deletion)
    
}